<html xmlns:th="https://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>部门管理</title>
  <!--    <link href="css/style.css" rel="stylesheet" type="text/css">-->
  <!--    <link href="css/style_.css" rel="stylesheet" type="text/css">-->
  <link href="../../css/style.css" rel="stylesheet">
  <link href="css/style_.css" rel="stylesheet">

  <script>
    function shanchu() {
      // var xg = confirm("是否确定删除这些员工？");
      // if (xg == true) {
      alert("删除成功！！！");
      // } else {
      //     alert("取消删除！！！");
      // }
    }

    function selectAllByChk(chk, checkbox) {
      var size = checkbox.length;
      if (size == null)
        checkbox.checked = chk.checked;
      else {
        for (i = 0; i < checkbox.length; i++) {
          checkbox[i].checked = chk.checked;
        }
      }
    }
  </script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="25" align="center" valign="bottom" class="td06">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="2%" valign="middle" background="images/bg_03.gif">&nbsp;</td>
            <td width="2%" valign="middle" background="images/bg_03.gif"><img
                    src="images/main_28.gif" width="9" height="9" align="absmiddle"></td>
            <td height="30" valign="middle" background="images/bg_03.gif">
              <div align="left"><font color="#FFFFFF">单位员工管理</font></div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">
    <tr>
      <td colspan="4" class="td_02"><SPAN class=td_title>员工查询</SPAN></td>
    </tr>
    <form th:action="@{/personnel/selectone}" method="post">
      <tr>
        <td width="10%" class="td_02">员工姓名</td>
        <td width="40%" class="td_02"><input name="nickname" th:value="${users1.nickname}" type="text"
                                             class="input" style="width:95% ">
        </td>
        <td width="10%" class="td_02">所属部门</td>
        <td width="40%" class="td_02">
          <select name="logoncount" size="1" class="box" style="width:95%">
            <option value="0">--请选择--</option>
            <option th:each="d:${departments}" th:value="${d.ID}" th:text="${d.depname}"
                    th:selected="${d.ID == users1.logoncount}" selected>
            </option>
          </select>
        </td>
      </tr>
      <tr>
        <td class="td_02">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务</td>
        <td class="td_02">
          <select name="mobile" style="width:95% ">
            <option value="0" selected>--请选择--</option>
            <option th:each="user_dutyDao:${user_dutyDaos}" th:value="${user_dutyDao.ID}"
                    th:text="${user_dutyDao.name}" th:selected="${user_dutyDao.ID == users1.mobile}"
                    selected></option>
          </select>
        </td>
        <td class="td_02">&nbsp;</td>
        <td class="td_02"><input name="Submit2" type="submit" class="buttonface02" value=" 查  询 "></td>
      </tr>
    </form>

  </table>
  <br>
  <form method="post" th:action="@{/personnel/deleteUser}">
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td class="td_page">
          <div align="right">
            <input name="Submit2" type="button" class="buttonface02" value="新增员工"
                   onClick="location.href='/personnel/insert'">
            <input name="Submit2" type="submit" class="buttonface02" value="删除选中的员工"
                   onClick="shanchu()">
          </div>
        </td>
      </tr>
    </table>
        <table width="95%" border="0" cellpadding="0" cellspacing="0" class="table02" align="center">
    <tr>
      <td height="30" align="right">
        <div align="left" th:if="${users.totalRows==0}">
            <img src="images/1.gif" width="4" height="5"
                 align="absmiddle">
            首页&nbsp;&nbsp;&nbsp;
            <img src="images/2.gif" width="3" height="5"
                 align="absmiddle">
            上一页&nbsp;&nbsp;&nbsp;
            <img src="images/2-2.gif" width="3" height="5"
                 align="absmiddle">
            下一页&nbsp;&nbsp;&nbsp;
            <img src="images/3.gif" width="4" height="5"
                 align="absmiddle">
            末页&nbsp;&nbsp;&nbsp; 第1页　　共1页 0 条记录
        </div>
        <div th:if="${users1.mobile != 0 || users1.logoncount != 0 || (users1.nickname != null && users1.nickname != '')}">
            <img src="images/1.gif" width="4" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/selectone?pagenum=1&nickname='+${users1.nickname==null?'':users1.nickname}+'&logoncount='+${users1.logoncount}+'&mobile='+${users1.mobile}}">首页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/2.gif" width="3" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/selectone?pagenum='+${users.pagenum - 1>0?users.pagenum -1:1}+'&nickname='+${users1.nickname}+'&logoncount='+${users1.logoncount}+'&mobile='+${users1.mobile}}">上一页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/2-2.gif" width="3" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/selectone?pagenum='+${users.pagenum +1<=users.totalPages?users.pagenum +1:users.totalPages}+'nickname='+${users1.nickname}+'&logoncount='+${users1.logoncount}+'&mobile='+${users1.mobile}}">下一页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/3.gif" width="4" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/selectone?pagenum='+${users.totalPages}+'&nickname='+${users1.nickname}+'&logoncount='+${users1.logoncount}+'&mobile='+${users1.mobile}}">末页</a>&nbsp;&nbsp;&nbsp; 第[[${users.pagenum}]]页　　共 [[${users.totalPages}]] 页 [[${users.totalRows}]] 条记录
        </div>
        <div th:if="${users1.mobile == 0 && users1.logoncount == 0 && !(users1.nickname != null && users1.nickname != '')}">
            <img src="images/1.gif" width="4" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/select?pagenum=1'}">首页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/2.gif" width="3" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/select?pagenum='+${users.pagenum -1>0?users.pagenum -1:1}}">上一页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/2-2.gif" width="3" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/select?pagenum='+${users.pagenum +1<=users.totalPages?users.pagenum +1:users.totalPages}}">下一页</a>&nbsp;&nbsp;&nbsp;
            <img src="images/3.gif" width="4" height="5"
                 align="absmiddle">
            <a th:href="@{'/personnel/select?pagenum='+${users.totalPages}}">末页</a>&nbsp;&nbsp;&nbsp; 第[[${users.pagenum}]]页　　共 [[${users.totalPages}]] 页 [[${users.totalRows}]] 条记录
        </div>
      </td>
    </tr>
  </table>
    <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="table01">
      <tr>
        <td width="5%" class="td_top"><input name="chk" type="checkbox" id="chk"
                                             onClick="selectAllByChk(chk,checkbox)" value="checkbox0"></td>
        <td width="10%" class="td_top">用户姓名</td>
        <td width="11%" class="td_top">所属部门</td>
        <td width="13%" class="td_top">职 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务</td>
        <td width="14%" class="td_top">生日</td>
        <td width="21%" class="td_top">移动电话</td>
        <td width="13%" class="td_top">办公电话</td>
        <td width="13%" class="td_top">修改员工</td>
      </tr>
      <tr th:each="user:${users.dates}">
        <td class="td_02" height="25"><input type="checkbox" name="checkbox" th:value="${user.ID}"></td>
        <td class="td_02"><font color="#000000">
          <a th:href="@{'/personnel/manageuser?id='+${user.ID}}">[[${user.nickname}]]</a></font>
        </td>
        <td class="td_02" th:each="department:${departments}" th:if="${user.logoncount==department.ID}">
            [[${department.depname}]]
        </td>
        <td class="td_02" th:each="user_dutyDao:${user_dutyDaos}" th:if="${user.mobile==user_dutyDao.ID}">
            [[${user_dutyDao.name}]]
        </td>
        <td class="td_02">[[${user.birthday}]]</td>
        <td class="td_02">[[${user.phone}]]</td>
        <td class="td_02">[[${user.workphone}]]</td>
        <td class="td_02"><a th:href="@{'/personnel/updateuser?id='+${user.ID}}">修
          改</a></td>
      </tr>
    </table>
  </form>
  <p>&nbsp;</p>
</center>
</body>
</html>
